Functions > PIC2List Functions > PIC2List Generic Packet Functions |
The P2PktGeneric structure is defined as:
Copy Code | |
---|---|
typedef struct {
BYTE Type;
DWORD Length;
BYTE Data[1];
} P2PktGeneric;
|
Copy Code | |
---|---|
P2PktGeneric* P2LInsert(P2LIST* p2l, P2PktGeneric* pktInsertBefore, BYTE type, DWORD len, BYTE* data) |
P2LInsert inserts a PIC2List packet of type with data of length len immediately before an existing packet pktInsertBefore. If pktInsertBefore, insert at end. If list is empty, ignore pktInsertBefore and just add the packet. If data == 0, then the packet is allocated and the data is set to 0. Returns 0 if a memory allocation error occurs and on an attempt to add a P2P_EOF packet
Copy Code | |
---|---|
P2PktGeneric* P2LAdd(P2LIST* p, BYTE type, DWORD len, const BYTE* data); |
P2LAdd adds a packet to a PIC2List, enlarging the list if necessary. The packet type is type, the packet data, of length len bytes, is pointed to by data. If data is a null pointer the packet is added to the list, but the packet data area isn't initialized. A pointer is returned to the added packet. If a null pointer is returned, then a memory allocation error occurred attempting to enlarge the list.
Copy Code | |
---|---|
BOOL P2LDelete(P2LIST* p2l, P2PktGeneric* pkt); |
P2LDelete deletes a packet from the PIC2List. pkt must point into the PIC2List to the Type field of the packet to be deleted. No validation is performed.
Copy Code | |
---|---|
P2PktGeneric* P2LFirst(const P2LIST* p2l); |
P2LFirst returns a pointer to the first packet in the PIC2List. P2LFirst returns 0 if the list is empty or if the only packet in the list is the PIC2List EOF packet.
Copy Code | |
---|---|
P2PktGeneric* P2LNext(const P2LIST* p2l, P2PktGeneric* pkt); |
P2LNext returns a pointer to the packet following a given packet. Pkt must point into the PIC2List to the Type field of a packet. No validation is performed. If 0 is returned, then there are no packets following the packet.
Copy Code | |
---|---|
P2PktGeneric* P2LFind(const P2LIST* p2l, BYTE type); |
P2LFind returns a pointer to the first packet of the requested type. P2LFind returns 0 if there is no packet in the PIC2List of the requested type.
Copy Code | |
---|---|
P2PktGeneric* P2LFindNext(const P2LIST* p2l, const P2PktGeneric* pkt); |
P2LFindNext returns a pointer to the next packet following pkt whose type is pkt->Type. pkt must point into the PIC2List to the Type field of a packet. No validation is performed. P2LFindNext returns 0 if there are no packets following pkt in PIC2List whose type is the same as pkt->Type.